#include<cstdio>
int abs(int x)
{
	if(x<0)return x*(-1);
	else return x;
}
int max(int x,int y)
{
	return x>y?x:y;
}
int main()
{
	int t;
	char c;
	scanf("%d%c",&t,&c);
	while(t--)
	{
		char c1,c2,c3,c4,c5,c6;
		scanf("%c%c%c%c%c%c",&c1,&c2,&c3,&c4,&c5,&c6);
		int x1=c2-'0',y1=8-(c1-'a'),x2=c5-'0',y2=8-(c4-'a');
		//printf("%c %c %d %d %d %d",c1,c2,x1,y1,x2,y2);
		if(x1==x2&&y1==y2)printf("0 0 0 0\n");
		else
		{
			int a1,a2,a3,a4;
			a1=max(abs(x1-x2),abs(y1-y2));
			a2=(x1==x2||y1==y2||(x1-y1)==(x2-y2)||(x1+y1)==(x2+y2))?1:2;
			a3=(x1==x2||y1==y2)?1:2;
			if((x1+x2+y1+y2)%2==1)a4=-1;
			else a4=((x1-y1)==(x2-y2)||(x1+y1)==(x2+y2))?1:2;
			if(a4==-1)printf("%d %d %d Inf\n",a1,a2,a3);
			else printf("%d %d %d %d\n",a1,a2,a3,a4);
		}
	}
	return 0;
}
		
